<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let arr = ['赵云', '黄忠', '张飞', '马超', '刘备', '曹操']
        // 数组的length为7 那我们需要索引 或者说随机数要0-6
        let i = Math.floor(Math.random() * arr.length)
        console.log(i);
        let name = arr[i]
        console.log(name);
    </script>
</body>

</html>